#ifndef SENSOR_H
#define SENSOR_H

enum Exception {ExcptNone, ExcptFire, ExcptCO, ExcptWater, ExcptBreakIn} ;
enum TypeOfSensor { TypeTemperature, TypeSmoke, TypeCO, TypeStress, TypeInfrared, TypeOpenClose, TypeWaterLvl };

struct Msg
{
	int MId;
	int SId;
	int Param1;
	int Param2;
};


class Sensor  //base class for sensor
{
protected:
	int SId;
	Msg SMsg;
public:
	Sensor();
     bool operator == (Sensor *s1 );
	 bool operator != (Sensor *s1 );
	 virtual TypeOfSensor ReturnType();
 
   	virtual Msg ReturnMsg() = 0; //  return Msg  
 };




//-----------------------for fire prevention
class SensorTemperature : public Sensor
{
private:
	float TemperaturePoint;  //CriticalPoint for sensor 
public:
	SensorTemperature();
 	SensorTemperature(int roomid,  float CP=20);
	TypeOfSensor ReturnType();

	void CaptureTemperature(float temperature)  ; // get information from environment, judge the situation according to the data get from outside environment  
	void SetCP(float CP);   //configure the CP of sensor
	Msg ReturnMsg();       
};


class SensorSmoke : public Sensor
{
private:
	float SmokePoint;
public:
	SensorSmoke();
 	SensorSmoke(int roomid, float CP=0);
	TypeOfSensor ReturnType();

	void CaptureSmokeDense(float SmokeDensity)  ;
	void SetCP(float CP);
	Msg ReturnMsg();
};

//----------------for CO prevention
class SensorCO : public Sensor
{
private:
	float COPoint;
public:
	SensorCO();
 	SensorCO(int roomid, float CP=0);
	TypeOfSensor ReturnType();

	void CaptureCODense(float CODensity)  ;
	void SetCP(float CP);
	Msg ReturnMsg();
};

//---------------for break-in prevention
class SensorStress : public Sensor
{
private:
	int StressPoint;
public:
	SensorStress();
 	SensorStress(int roomid, int CP=0);
	TypeOfSensor ReturnType();

	void CaptureStress(int Stress)  ;
	void SetCP(int CP) ;  
	Msg ReturnMsg();
};

class SensorInfrared : public Sensor
{
private:
	int InfraredPoint;
public:
	SensorInfrared();
 	SensorInfrared(int roomid, int CP=0);
	TypeOfSensor ReturnType();

	void CaptureInfrared(int Infrared)  ;
	void SetCP(int CP);
	Msg ReturnMsg();
};

class SensorOpenClose : public Sensor
{
private:
	bool OpCls;
public:
	SensorOpenClose();
 	SensorOpenClose(int roomid, bool CP=false);
	TypeOfSensor ReturnType();

	void CaptureOpCls(bool OpCls)  ;
 	Msg ReturnMsg();
};


//-----------------for water overflow prevention
class SensorWaterLvl : public Sensor
{
private:
	int WaterLvlPoint;
public:
	SensorWaterLvl();
	SensorWaterLvl(int roomid, int CP=0);
	TypeOfSensor ReturnType();

	void CaptureWaterLvl(int WaterLvl)  ;
	void SetCP(int WaterLvl) ;
	Msg ReturnMsg();
};


 

#endif